<?php
namespace UserSystem;

/**
 * Class Config
 * @author wangxi
 * 配置解析类
 * @modi 15-21-1
 */
class Config
{
    private static $_instance;

    protected $config;

    private function __construct()
    {
        $conf_file = P_APP . 'config.php';
        if (!file_exists($conf_file)) {
            die('配置文件: ' . $conf_file . ' 不存在');
        }

        $this->config = require($conf_file);
    }

    public static function getInstance()
    {
        if (!isset(self::$_instance)) {
            self::$_instance = new self();
        }

        return self::$_instance;
    }

    public function get($item)
    {
        if (isset($this->config[$item])) {
            return $this->config[$item];
        }

        return false;
    }

}